package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.zjsd.sqeybusiness.domain.Recharesetting;
import com.zjsd.sqeybusiness.service.IRecharesettingService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 充值配置Controller
 *
 * @author Zheng
 * @date 2025-03-26
 */
@RestController
@RequestMapping("/sqeybusiness/recharesetting")
public class RecharesettingController extends BaseController
{
    @Autowired
    private IRecharesettingService recharesettingService;

    /**
     * 查询充值配置列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:recharesetting:list')")
    @GetMapping("/list")
    public TableDataInfo list(Recharesetting recharesetting)
    {
        startPage();
        List<Recharesetting> list = recharesettingService.selectRecharesettingList(recharesetting);
        return getDataTable(list);
    }

    /**
     * 导出充值配置列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:recharesetting:export')")
    //@Log(title = "充值配置", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Recharesetting recharesetting)
    {
        List<Recharesetting> list = recharesettingService.selectRecharesettingList(recharesetting);
        ExcelUtil<Recharesetting> util = new ExcelUtil<Recharesetting>(Recharesetting.class);
        return util.exportExcel(list, "recharesetting");
    }

    /**
     * 获取充值配置详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:recharesetting:query')")
    @GetMapping(value = "/{settingid}")
    public AjaxResult getInfo(@PathVariable("settingid") Long settingid)
    {
        return AjaxResult.success(recharesettingService.selectRecharesettingById(settingid));
    }

    /**
     * 新增充值配置
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:recharesetting:add')")
    //@Log(title = "充值配置", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Recharesetting recharesetting)
    {
        return toAjax(recharesettingService.insertRecharesetting(recharesetting));
    }

    /**
     * 修改充值配置
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:recharesetting:edit')")
    //@Log(title = "充值配置", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Recharesetting recharesetting)
    {
        return toAjax(recharesettingService.updateRecharesetting(recharesetting));
    }

    /**
     * 删除充值配置
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:recharesetting:remove')")
    //@Log(title = "充值配置", businessType = BusinessType.DELETE)
	@DeleteMapping("/{settingids}")
    public AjaxResult remove(@PathVariable Long[] settingids)
    {
        return toAjax(recharesettingService.deleteRecharesettingByIds(settingids));
    }
}
